<template>
  <div class="pb-[20px]">
    <Device />
    <Fenxi @click="clickItem" />
    <Alarm />
  </div>
</template>
<script setup lang="ts">
import Device from './components/Device.vue';
import Fenxi from './components/Fenxi.vue';
import Alarm from './components/Alarm.vue';
const router = useRouter();
// import { apiGetGroups } from '@/http/api';
// import { eMenuType } from '@/interface/enum';
// import { eventBus } from '@/utils/event_bus';
// import { large_screen_routes } from '@/router/large_screen_monitoring';
// const router = useRouter();

// const getGroups = async () => {
//   try {
//     const res = await apiGetGroups();

//     if (res.data && res.data.length > 0) {
//       res.data.forEach((item, i) => {
//         console.log(item);

//         addRoute(item.parent_name, item.second_name, i);
//       });
//       eventBus.emit('refresh_menu');
//     }
//   } catch (error) {}
// };

// function addRoute(parent_name: string, second_name: string, id: number) {
//   const routeObject = {
//     path: '/large_screen/zfn/fx/' + id,
//     name: 'zfn_fx_' + id,
//     meta: {
//       menu_show: true,
//       menu_type: eMenuType.PAGE,
//       title: second_name,
//       parentPath: '/large_screen/zfn',
//       sort: 1,
//       params: { parent_name, second_name },
//     },
//     component: () => import('../fenxi/index.vue'),
//   };
//   const info = large_screen_routes.children![0].children!.find(item => item.meta!.title === second_name);
//   if (!info) {
//     large_screen_routes.children![0].children!.push(routeObject);
//   }
//   router.addRoute('zfn', routeObject); // 添加路由
// }
const clickItem = (e: any) => {
  router.push({ name: 'data_report_today', query: { name: e.name } });
};
onMounted(() => {
  // setTimeout(() => {
  //   getGroups();
  // }, 100);
});
</script>
<style lang="less" scoped></style>
